﻿using BusinessLogic.Audit;
using BusinessLogic.Configuration;
using BusinessLogic.Infrastructure;
using BusinessLogic.Tasks;
using BusinessLogic.Messages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MailWindowsService
{
    public partial class BaseAdministration
    {
        public BaseAdministration()
        {
            PayrollConfig.Init();
            if (SqlHelper.ConnectionStringIsSet())
            {
                //initialize IoC
                IoC.InitializeWith(new DependencyResolverFactory());

                //initialize task manager
                TaskManager.Instance.Initialize(PayrollConfig.ScheduleTasks);
                TaskManager.Instance.Start();
            }
        }
        /// <summary>
        /// Gets the log service.
        /// </summary>
        /// <value>
        /// The log service.
        /// </value>
        public ILogService LogService
        {
            get { return IoC.Resolve<ILogService>(); }
        }
        /// <summary>
        /// Gets the message service.
        /// </summary>
        /// <value>
        /// The message service.
        /// </value>
        public IMessageService MessageService
        {
            get { return IoC.Resolve<IMessageService>(); }
        }
        /// <summary>
        /// Gets the results service.
        /// </summary>
        /// <value>
        /// The results service.
        /// </value>
        public IResultsService ResultsService
        {
            get { return IoC.Resolve<IResultsService>(); }
        }
    }
}
